/**
 * Created by feifan on 2016/7/6.
 */
var express = require('express');
var router = express.Router();
var ueditor = require("ueditor");

router.use('/', ueditor(__dirname, function (req, res) {
    let img_url = '/../uploads/img';
    //let file_url = '/../uploads/files';
    switch (req.query.action){
        case 'uploadimage':
            res.ue_up(img_url);
            break;
        case 'listimage':
            res.ue_list(img_url);
            break;
        case 'config':
            res.redirect('/editor/ueditor.config.json');
            break;
        default:
            res.end();
            break;
    }
}));

module.exports = router;